package com.cartoon.adapter;

import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.cartoon.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import model.CarrtonKKSearchModel;
import pic.PicLoadManager;

public  class KKSearchCarttonAdapter extends BaseQuickAdapter<CarrtonKKSearchModel.HitsBean, BaseViewHolder> {
    public KKSearchCarttonAdapter(int layoutResId, @Nullable @org.jetbrains.annotations.Nullable List<CarrtonKKSearchModel.HitsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CarrtonKKSearchModel.HitsBean item) {
        ImageView pic = helper.itemView.findViewById(R.id.iv_pig);
        TextView tv_name = helper.itemView.findViewById(R.id.tv_name);
        TextView tv_time = helper.itemView.findViewById(R.id.tv_time);
        PicLoadManager.loadPicture(item.getVertical_image_url(),pic);
        helper.setText(R.id.tv_name,item.getTitle());
        helper.setText(R.id.tv_time,item.getCategory().toString());

        tv_name.setSelected(true);
        tv_time.setSelected(true);
    }
}
